import 'package:flutter/material.dart';

///
///  自定义主题 详细的文档可以参考
///  https://api.flutter.dev/flutter/material/ThemeData-class.html
///
class LearnApp03 extends StatelessWidget{

  final appName = "自定义主题风格";

  const LearnApp03({super.key});

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
     return  MaterialApp(
      title: appName,
      theme: ThemeData(
        brightness: Brightness.light,
        primaryColor: Colors.lightGreen,
        colorScheme: ColorScheme.light(
          primary:  Colors.lightGreen,
          secondary: Colors.yellow

        )
      ),
      home: LearnApp03HomePage(title: appName)
    );
  }

}


class LearnApp03HomePage extends StatelessWidget{


  final String title;
   const LearnApp03HomePage({super.key,required this.title});



  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(title),
      ),
      body: Center(
        child: Container(
          color: Theme.of(context).primaryColor,
          child: Text(
            "带有背景颜色的文本组件",
            style: Theme.of(context).textTheme.titleLarge,
          ),
        ),
      ),
      floatingActionButton:FloatingActionButton(
            onPressed: (){
              print("点击事件");
            },
            child: Icon(Icons.computer),
          )
    );
  }

}